package book;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 28463
 * Date: 2022—05—21
 * Time: 9:32
 */
public class BookList {
    //最多存放20本书
    private Book[] books = new Book[20];

    private int usedSize;//实时记录 当前Books这个数组中有多少本书

    public BookList() {
        books[0] = new Book("西游记","吴承恩",25,"小说");
        books[1] = new Book("红楼梦","曹雪芹",26,"小说");
        books[2] = new Book("三国演义","罗贯中",27,"小说");
        books[3] = new Book("水浒传","施耐庵",28,"小说");
        usedSize = 4;//当前有4本书
    }
    /*
    * 此时pos位置一定是合法的
    * return一本书
    * */
    public Book getBook(int pos) {
        return books[pos];
    }
    /*
    * 此时pos位置一定是合法的
    * book是你要存放的书
    * */
    public void setBooks(int pos,Book book) {
        books[pos] = book;
    }
    public int getUsedSize(){
        return usedSize;
    }
    /*
    * 实时修改当前书架上的书的个数
    *
    * */
    public void getUsedSize(int size) {
        usedSize = size;
    }


}
